
//游戏分数和游戏结束
var dataObj = function() {
    this.ctx = ctxMain;
    this.fruitNum = 1;
    this.double = 1;
    this.score = 0;
    this.gameOver = false;
    this.alpha = 0;
};
dataObj.prototype.draw = function() {
    var w = canWidth;
    var h = canHeight;

    this.ctx.save();
    //分数显示
    this.ctx.fillStyle = "white";
    this.ctx.font = "34px YouYuan";
    this.ctx.fillText("分数:" + this.score, w*0.5 - 80, h-20);
    //提示游戏结束
    if(this.gameOver) {
        this.ctx.font = "34px YouYuan";

        this.alpha += deltaTime*0.0005;
        if(this.alpha > 1)
            this.alpha = 1;
        this.ctx.shadowBlur = 10;
        this.ctx.shadowColor = "white";
        this.ctx.fillStyle = "rgba(255,255,255," + this.alpha+")";
        this.ctx.fillText("游戏结束！", w*0.5 - 110, h*0.5);
    }
    this.ctx.restore();
};
dataObj.prototype.addScore = function() {
    this.score += this.fruitNum*100*this.double;
    this.fruitNum = 1;
    this.double = 1;
};